layui.use(['form', 'fsoft'], function () {
	var $ = layui.$
		, form = layui.form
		, fsoft = layui.fsoft;
	var id = $('#id').val();
	form.render();
	// 监听提交
	form.on('submit(save)', function (data) {
		var submitUrl = layui.cache['contentPath'] + '/sys-dict/save';
		if (id != undefined && id != "") {
			submitUrl = layui.cache['contentPath'] + '/sys-dict/modify';
		}
		fsoft.put(submitUrl, data.field, function (rs) {
			if (rs.code == 0) {
				fsoft.successMsg((id != undefined && id != "") ? "编辑成功" : "新增成功");
				xadmin.close();
			} else {
				layer.msg(rs.msg, { icon: 2, time: 3000 });
			}
		});
		return false;
	});
});